<?php
function grps_theme_setup() { 
	add_editor_style(); /* TODO: Create editor style */
	
	add_theme_support( 'post-thumbnails' );
	/* TODO: Define post thumbnail sizes set_post_thumbnail_size( ???, ???, true ); */
	
	add_theme_support( 'automatic-feed-links' );
	
	load_theme_textdomain( 'violin-creative', TEMPLATEPATH . '/languages' );
	
	$locale = get_locale();
	$locale_file = TEMPLATEPATH . "/languages/$locale.php";
	if ( is_readable( $locale_file ) )
		require_once( $locale_file );
	
	register_nav_menus( array(	'primary' => __( 'Primary Navigation', 'violin-creative' ), ) );
	
	add_custom_background();
}

function grps_remove_admin_bar() {
	return false;
}
add_filter( 'show_admin_bar' , 'grps_remove_admin_bar');

function grps_clear_wp_head() {
	remove_action( 'wp_head', 'index_rel_link' );
	remove_action( 'wp_head', 'parent_post_rel_link', 10, 0 );
	remove_action( 'wp_head', 'start_post_rel_link', 10, 0 );
	remove_action( 'wp_head', 'adjacent_posts_rel_link', 10, 0 );
	remove_action( 'wp_head', 'wp_generator',10, 0 );
}
add_action( 'init', 'grps_clear_wp_head' );

function grps_page_title() {
	global $page, $paged;

	wp_title( '|', true, 'right' );

	bloginfo( 'name' );

	$site_description = get_bloginfo( 'description', 'display' );
	if ( $site_description && ( is_home() || is_front_page() ) )
		echo " | $site_description";

	if ( $paged >= 2 || $page >= 2 )
		echo ' | ' . sprintf( __( 'Page %s', 'violin-creative' ), max( $paged, $page ) );
}

function grps_excerpt_length( $length ) {
	return 40; /* TODO: Make excerpt length configurable via the admin panel */
}
add_filter( 'excerpt_length', 'grps_excerpt_length' );

function grps_continue_reading_link() {
	return ' <a href="'. get_permalink() . '">' . __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'violin-creative' ) . '</a>';
}

function grps_auto_excerpt_more( $more ) {
	return ' &hellip;' . grps_continue_reading_link();
}
add_filter( 'excerpt_more', 'grps_auto_excerpt_more' );

function grps_custom_excerpt_more( $output ) {
	if ( has_excerpt() && ! is_attachment() ) {
		$output .= grps_continue_reading_link();
	}
	return $output;
}
add_filter( 'get_the_excerpt', 'grps_custom_excerpt_more' );

function grps_remove_gallery_css( $css ) {
	return preg_replace( "#<style type='text/css'>(.*?)</style>#s", '', $css );
}
add_filter( 'gallery_style', 'grps_remove_gallery_css' );

function grps_remove_recent_comments_style() {
	global $wp_widget_factory;
	remove_action( 'wp_head', array( $wp_widget_factory->widgets[ 'WP_Widget_Recent_Comments' ], 'recent_comments_style' ) );
}
add_action( 'widgets_init', 'grps_remove_recent_comments_style' );

function grps_add_stylesheets() {
	
/* 	$stylesheetsUrl = get_bloginfo( 'template_url' );
	$stylesheetsFiles = dirname(__FILE__);
	
	$screenResetStylesheetUrl = $stylesheetsUrl . '/includes/css/core/screen.css';
	$screenResetStylesheetFile = $stylesheetsFiles . '\includes\css\core\screen.css';
	
	if ( file_exists( $screenResetStylesheetFile ) ) {
		wp_register_style( 'screen', $screenResetStylesheetUrl, null, null, 'screen' );
		wp_enqueue_style( 'screen' );
	} */
}
//add_action( 'wp_print_styles', 'grps_add_stylesheets' );

// TODO: Add function for post and page description
// TODO: Add function for post and page author
// TODO: Add function for pingback
// TODO: Remove container from wp_nav_menu
?>